<?PHP
session_start();
date_default_timezone_set("Asia/Chongqing");
include("../config/connect.php");
include("../public/common.php");
include("../public/biaoqing.php");


if( !HasLogin() ) 
{
	$url = "Location:login.php?ref=edit_items.php";
	header($url);
}

$userid = $_SESSION["userid"];

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>编辑商品</title>
<style type="text/css">
ul, ol, dl, li { list-style:none;}
#recomtag ul { margin:0; padding:5px;}
#recomtag ul li a { margin:0 5px; cursor:pointer;}
.gsT_r h2,.gsT_r a { float:left; padding:0; margin:0; font-size:12px;}
.gsT_r { font-size:12px; line-height:20px;}
.gsT_r .gs_key { overflow:hidden; width:100%; display:block; clear:both;}
#recomtag ul li a:hover { color:#fff; background:#F6C;}
</style>
<script language="javascript" src="../js/jquery.min.js"></script>
<script language="javascript">
function gup(id) {
	var dz_url = document.getElementById("itemurl").value;
    id = id.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");
    var regexS = "[\\?&]"+id+"=([^&#]*)";
    var regex = new RegExp( regexS );
    var results = regex.exec(dz_url);
    if( results == null ) {
        return "";
    } else {
        return results[1];
    }
}

function OnSync()
{
	//var itemid = document.getElementById("itemid").value;
//	alert(itemid);
	var url_id = "";
	if(gup("id") != ""){
		url_id = gup("id");  //个人 商城
	}
	else if(gup("item_num_id") != "" ){
		url_id = gup("item_num_id");  //部分话旗舰店
	}	
	else if(gup("item_id") != "" ){
		url_id = gup("item_id");  //// 旅游、酒店
	}
	else if(gup("mallstItemId") != "" ){
		url_id = gup("mallstItemId");  //// 淘宝商城官方旗舰店
	}
	
	if (url_id=="")
		return;
	
	document.getElementById("itemid").value = url_id;

	var url = "http://www.tusijie.com/admin/find_item.php?itemid=" + url_id;
	$.ajax({url: url,
			async: false,
			success:function(res)
			{
				//	alert(res);
				var resObj = eval('(' + res + ')');
				if (resObj.code == 1)
					document.getElementById("ishasitem").innerHTML="<font color='#FF0000'>已经有相同的商品哦</font>";
				else if (resObj.code == 0)
					document.getElementById("ishasitem").innerHTML="";
				else
					alert("判断是否存在商品出错！请找冰峰");			
			}
		});

	//
	url = "http://www.tusijie.com/admin/get_item_info.php?itemid=" + url_id;
	$.ajax({url: url,
			async: false,
			success:function(res)
			{
				//	alert(res);
				var resObj = eval('(' + res + ')');
				
				//	alert(resObj.tag);
				if (resObj.code == 1)
				{
					document.getElementById("url").value=resObj.click_url ? resObj.click_url : resObj.detail_url;
					document.getElementById("itemname").value=resObj.title;
					document.getElementById("tag").value=resObj.tag;
					document.getElementById("picurl").value=resObj.pic_url;
					document.getElementById("fee_view").value=resObj.price;
					document.getElementById("fee").value=resObj.price;
					document.getElementById("commission_view").value=resObj.commission ? 0.1*parseInt(resObj.commission*100)/100 : 0;
					document.getElementById("commission").value=resObj.commission ? resObj.commission : 0;
					document.getElementById("pic").src=resObj.pic_url ? resObj.pic_url : "";
				}
			}
		});
}

</script>
</head>
<body>
<?php
$id = CheckUrlParamNoDie("id");
$opt = CheckUrlParamNoDie("opt");
$itemid = "";
$itemname = "";
$systag = "";
$tag = "";
$fee = 0;
$commission = 0;
$url = "";
$picurl = "";
$desc = "";

if( $id != "" )
{
	$sql = "select * from goods_items where id=$id limit 1";
	$result = mysql_query( $sql );
	if( $result && $row = mysql_fetch_assoc( $result ) )
	{
		$itemid = $row["num_iid"];
		$itemname = $row["item_title"];
		$systag = $row["sys_tag"];
		$tag = $row["tag"];
		$fee = $row["fee"];
		$commission = $row["commission"];
		$url = $row["url"];
		$picurl = $row["pic_url"];
		$desc = $row["r_desc"];
	}
}

if( $opt == "save" && isset( $_POST["submit"] ))
{
	$itemid = GetPostParamStr("itemid");
	$itemname = mysql_real_escape_string(GetPostParamStr("itemname"));
	$systag = mysql_real_escape_string(trim(GetPostParamStr("systag")));
	$tag = mysql_real_escape_string(" ".trim(GetPostParamStr("tag"))." ");
	$fee = GetPostParamStr("fee");
	$commission = GetPostParamStr("commission");
	$url = mysql_real_escape_string(GetPostParamStr("url"));
	$picurl = mysql_real_escape_string(GetPostParamStr("picurl"));
	$desc = mysql_real_escape_string(GetPostParamStr("desc"));

	if ($id == "")	// insert
	{
		if ($_SESSION["right"] < 1000){
			$sql = "insert into goods_items (num_iid, item_title, fee, commission, pic_url, url, user_id, sys_tag, tag, r_desc, state) values ('$itemid', '$itemname', $fee, $commission, '$picurl', '$url', $userid, '$systag', '$tag', '$desc', 0)";	
		}else{
			$sql = "insert into goods_items (num_iid, item_title, fee, commission, pic_url, url, user_id, sys_tag, tag, r_desc, state) values ('$itemid', '$itemname', $fee, $commission, '$picurl', '$url', $userid, '$systag', '$tag', '$desc', 2)";
		}
	}
	else	// update
	{
		$sql = "update goods_items set item_title='$itemname', fee=$fee, commission=$commission, pic_url='$picurl', url='$url', sys_tag='$systag', tag='$tag', r_desc='$desc' where id=$id";
	}

//	echo $sql;
//	exit;
	mysql_query( $sql );
	if (mysql_affected_rows() == 0)
	{
		if ($id == "")
			echo "<script>alert('插入失败，请找程序员。');</script>";
		else
			echo "<script>alert('没有条目被更新，如有疑问，请找程序员。');</script>";
	}
	else
	{
		if ($id == "")
			echo "<script>alert('添加成功!');window.history.go(-2);</script>";
		else
			echo "<script>alert('编辑成功!');window.history.go(-2);</script>";
	}
}

?>
<div align="center" class="STYLE1">添加/编辑商品后台 <span class="STYLE2">当前用户：</span><?PHP echo $_SESSION["email"]; ?></div>
<br />
<form id="frm" action="?id=<?PHP echo $id; ?>&opt=save" method="post" onsubmit="javascript:return OnSubmit()">
<table cellpadding="0" cellspacing="0" border="1" align="center">
	<tr>
    	<td width="90" height="30" align="center">商品URL：</td>
        <td >
        <input type="text" name="itemurl" id="itemurl" value="" size="70" />
        <span id="ishasitem"></span>
        <input type="hidden" name="itemid" id="itemid" value="<?PHP echo $itemid; ?>" />
        <input type="hidden" size="70" name="url" id="url" height="20" value="<?PHP echo $url; ?>"  />
        <input type="button" onclick="OnSync()" value="获取数据" /></td>
    </tr>
    <tr>
   	  <td width="90" height="30" align="center">名称：</td>
      <td height="30" ><input type="text" size="70" name="itemname" id="itemname" height="20" value="<?PHP echo $itemname; ?>"  /></td>
    </tr>
    <tr>
    	<td  height="30" align="center"s>系统标签：</td>
        <td width="622" ><select name="systag" id="systag" size="1">
	      <option <?PHP if ($systag == "") echo "selected='selected'"; ?>></option>
          <option value="衣服" <?PHP if ($systag == "衣服") echo "selected='selected'"; ?> >衣服</option>
          <option value="鞋子" <?PHP if ($systag == "鞋子") echo "selected='selected'"; ?> >鞋子</option>
          <option value="包包" <?PHP if ($systag == "包包") echo "selected='selected'"; ?> >包包</option>
          <option value="美妆" <?PHP if ($systag == "美妆") echo "selected='selected'"; ?> >美妆</option>
          <option value="配饰" <?PHP if ($systag == "配饰") echo "selected='selected'"; ?> >配饰</option>
          <option value="家居" <?PHP if ($systag == "家居") echo "selected='selected'"; ?> >家居</option>
        </select>
          &nbsp;<span style="font-size:12px">请选择系统分类，注意：如果选择不对，将无法展示商品</span></td>
    </tr>
    <tr style="background:#FF9;">
    	<td  height="30" align="center"s>网站热签：</td>
        <td width="622" >
        	<div id="recomtag">
            	<ul>
                	<li class="postItemRe">
                    	<div class="gsT_r rgary">
                    		<div class="gs_key"><h2 class="f14">流行元素：</h2>
                            	<a onclick="OnClickTag(this)">蕾丝</a>
                                <a onclick="OnClickTag(this)">波点</a>
                                <a onclick="OnClickTag(this)">碎花</a>
                                <a onclick="OnClickTag(this)">糖果色</a>
                                <a onclick="OnClickTag(this)">条纹</a>
                                <a onclick="OnClickTag(this)">格子</a>
                                <a onclick="OnClickTag(this)">蝴蝶结</a>
                                <a onclick="OnClickTag(this)">镂空</a>
                                <a onclick="OnClickTag(this)">撞色</a>
                                <a onclick="OnClickTag(this)">豹纹</a>
                                <a onclick="OnClickTag(this)">百搭</a>
                			</div>
                        	<div class="gs_key"><h2 class="f14">潮流风格：</h2>
                            	<a onclick="OnClickTag(this)">学院</a>
                                <a onclick="OnClickTag(this)">萌系</a>
                                <a onclick="OnClickTag(this)">中性</a>
                                <a onclick="OnClickTag(this)">英伦</a>
                                <a onclick="OnClickTag(this)">韩版</a>
                                <a onclick="OnClickTag(this)">清新</a>
                                <a onclick="OnClickTag(this)">复古</a>
                                <a onclick="OnClickTag(this)">性感</a>
                                <a onclick="OnClickTag(this)">欧美</a>
                                <a onclick="OnClickTag(this)">波西米亚</a>
                                <a onclick="OnClickTag(this)">公主</a>
                            </div>
                            <div class="gs_key"><h2 class="f14">当季热款：</h2>
                            	<a onclick="OnClickTag(this)">连衣裤</a>
                                <a onclick="OnClickTag(this)">针织</a>
                                <a onclick="OnClickTag(this)">厚底鞋</a>
                                <a onclick="OnClickTag(this)">打底</a>
                                <a onclick="OnClickTag(this)">打底衫</a>
                                <a onclick="OnClickTag(this)">罩衫</a>
                                <a onclick="OnClickTag(this)">信封包</a>
                                <a onclick="OnClickTag(this)">高帮鞋</a>
                                <a onclick="OnClickTag(this)">高跟鞋</a>
                                <a onclick="OnClickTag(this)">吊带裙</a>
                                <a onclick="OnClickTag(this)">T恤</a>
                                <a onclick="OnClickTag(this)">衬衫</a>
                            </div>
                            <div class="gs_key"><h2 class="f14">美容护肤：</h2>
                            	<a onclick="OnClickTag(this)">美白</a>
                                <a onclick="OnClickTag(this)">洁面</a>
                                <a onclick="OnClickTag(this)">腮红</a>
                                <a onclick="OnClickTag(this)">眼影</a>
                                <a onclick="OnClickTag(this)">BB霜</a>
                                <a onclick="OnClickTag(this)">面膜</a>
                                <a onclick="OnClickTag(this)">唇彩</a>
                                <a onclick="OnClickTag(this)">睫毛膏</a>
                                <a onclick="OnClickTag(this)">眼霜</a>
                                <a onclick="OnClickTag(this)">隔离霜</a>
                                <a onclick="OnClickTag(this)">香水</a>
                                <a onclick="OnClickTag(this)">补水</a>
                            </div>
                            <div class="gs_key"><h2 class="f14">网友热荐：</h2>
                            	<a onclick="OnClickTag(this)">街拍</a>
                                <a onclick="OnClickTag(this)">针织衫</a>
                                <a onclick="OnClickTag(this)">百搭</a>
                                <a onclick="OnClickTag(this)">显瘦</a>
                                <a onclick="OnClickTag(this)">vivi同款</a>
                                <a onclick="OnClickTag(this)">镂空</a>
                                <a onclick="OnClickTag(this)">呛口小辣椒</a>
                                <a onclick="OnClickTag(this)">浅口</a>
                                <a onclick="OnClickTag(this)">保湿</a>
                                <a onclick="OnClickTag(this)">HelloKitty</a>
                                <a onclick="OnClickTag(this)">个性</a>
                                <a onclick="OnClickTag(this)">帆布鞋</a>
                            </div>
            			</div>
                  	</li>
                    <!----衣服----->
                	<li class="postItem" style="display:none;">
                    	<div class="gsT_r rgary">
                    		<div class="gs_key"><h2 class="f14">上衣：</h2>
                            	<a onclick="OnClickTag(this)">衬衫</a>
                                <a onclick="OnClickTag(this)">T恤</a>
                                <a onclick="OnClickTag(this)">开衫</a>
                                <a onclick="OnClickTag(this)">吊带</a>
                                <a onclick="OnClickTag(this)">针织衫</a>
                                <a onclick="OnClickTag(this)">西装</a>
                                <a onclick="OnClickTag(this)">毛衣</a>
                                <a onclick="OnClickTag(this)">卫衣</a>
                                <a onclick="OnClickTag(this)">马甲</a>
                                <a onclick="OnClickTag(this)">外套</a>
                			</div>
                        	<div class="gs_key"><h2 class="f14">裙子：</h2>
                                <a onclick="OnClickTag(this)">长裙</a>
                                <a onclick="OnClickTag(this)">短裙</a>
                                <a onclick="OnClickTag(this)">连衣裙</a>
                                <a onclick="OnClickTag(this)">A字裙</a>
                                <a onclick="OnClickTag(this)">包臀裙</a>
                                <a onclick="OnClickTag(this)">蓬蓬裙</a>
                                <a onclick="OnClickTag(this)">裙裤</a>
                   			</div>
                        	<div class="gs_key"><h2 class="f14">长裤：</h2>
                            	<a onclick="OnClickTag(this)">牛仔裤</a>
                                <a onclick="OnClickTag(this)">铅笔裤</a>
                                <a onclick="OnClickTag(this)">阔腿裤</a>
                                <a onclick="OnClickTag(this)">喇叭裤</a>
                                <a onclick="OnClickTag(this)">工装裤</a>
                                <a onclick="OnClickTag(this)">休闲裤</a>
                                <a onclick="OnClickTag(this)">哈伦裤</a>
                                <a onclick="OnClickTag(this)">连身裤</a>
                                <a onclick="OnClickTag(this)">背带裤</a>
                			</div>
                        	<div class="gs_key"><h2 class="f14">短裤：</h2>
                            	<a onclick="OnClickTag(this)">短裤</a>
                                <a onclick="OnClickTag(this)">热裤</a>
                                <a onclick="OnClickTag(this)">九分裤</a>
                                <a onclick="OnClickTag(this)">打底裤</a>	
							</div>
                        	<div class="gs_key"><h2 class="f14">泳衣/家居服：</h2>
                            	<a onclick="OnClickTag(this)">分体</a>
                                <a onclick="OnClickTag(this)">连体</a>
                                <a onclick="OnClickTag(this)">比基尼</a>
                                <a onclick="OnClickTag(this)">睡衣</a>
                                <a onclick="OnClickTag(this)">内衣</a>	
                      		</div>
            			</div>
                  	</li>
                    <!----鞋子---->
                    <li class="postItem" style="display:none">
                   		<div class="gsT_r rgary">
                    		<div class="gs_key"><h2 class="f14">类别：</h2>
                            	<a onclick="OnClickTag(this)">平底鞋</a>	
                                <a onclick="OnClickTag(this)">高跟鞋</a>	
                                <a onclick="OnClickTag(this)">帆布鞋</a>	
                                <a onclick="OnClickTag(this)">单鞋</a>	
                                <a onclick="OnClickTag(this)">靴子</a>	
                                <a onclick="OnClickTag(this)">拖鞋</a>	
                                <a onclick="OnClickTag(this)">凉鞋</a>	
                			</div>
                        	<div class="gs_key"><h2 class="f14">鞋型：</h2>
                            	<a onclick="OnClickTag(this)">高跟</a>
                                <a onclick="OnClickTag(this)">坡跟</a>
                                <a onclick="OnClickTag(this)">防水台</a>
                                <a onclick="OnClickTag(this)">鱼嘴</a>
                                <a onclick="OnClickTag(this)">圆头</a>
                                <a onclick="OnClickTag(this)">高帮</a>
                                <a onclick="OnClickTag(this)">系带</a>
                                <a onclick="OnClickTag(this)">浅口</a>
                                <a onclick="OnClickTag(this)">平底</a>
                			</div>
                        	<div class="gs_key"><h2 class="f14">风格元素：</h2>
                            	<a onclick="OnClickTag(this)">vivi同款</a>
                                <a onclick="OnClickTag(this)">欧美</a>
                                <a onclick="OnClickTag(this)">罗马</a>
                                <a onclick="OnClickTag(this)">英伦</a>
                                <a onclick="OnClickTag(this)">波点</a>
                                <a onclick="OnClickTag(this)">豹纹</a>
                                <a onclick="OnClickTag(this)">镂空</a>
                                <a onclick="OnClickTag(this)">流苏</a>
                			</div>
						</div>
                    </li>
                    <!-----包包----->
                    <li class="postItem" style="display:none">
                    	<div class="gsT_r rgary">
                    		<div class="gs_key"><h2 class="f14">类别：</h2>
                            	<a onclick="OnClickTag(this)">斜挎包</a>
                                <a onclick="OnClickTag(this)">双肩包</a>
                                <a onclick="OnClickTag(this)">旅行箱</a>
                                <a onclick="OnClickTag(this)">单肩包</a>
                                <a onclick="OnClickTag(this)">手提</a>
                                <a onclick="OnClickTag(this)">钱包</a>
                                <a onclick="OnClickTag(this)">零钱包</a>
                			</div>
                        	<div class="gs_key"><h2 class="f14">风格材质：</h2>
                            	<a onclick="OnClickTag(this)">复古</a>
                                <a onclick="OnClickTag(this)">日韩</a>
                                <a onclick="OnClickTag(this)">欧美</a>
                                <a onclick="OnClickTag(this)">帆布</a>
                                <a onclick="OnClickTag(this)">休闲</a>
                                <a onclick="OnClickTag(this)">PU</a>
                                <a onclick="OnClickTag(this)">OL</a>
            				</div>
						</div>
                    </li>
                    <!---美妆---->
                    <li class="postItem" style="display:none">
                    	<div class="gsT_r rgary">
                    		<div class="gs_key"><h2 class="f14">彩妆：</h2>
                            	<a onclick="OnClickTag(this)">隔离</a>
                                <a onclick="OnClickTag(this)">BB霜</a>
                                <a onclick="OnClickTag(this)">眼妆</a>
                                <a onclick="OnClickTag(this)">遮瑕</a>
                                <a onclick="OnClickTag(this)">腮红</a>
                                <a onclick="OnClickTag(this)">眼影</a>
                                <a onclick="OnClickTag(this)">唇妆</a>
                                <a onclick="OnClickTag(this)">指甲油</a>
                                <a onclick="OnClickTag(this)">粉底</a>
                                <a onclick="OnClickTag(this)">眉笔</a>
                			</div>
                        	<div class="gs_key"><h2 class="f14">保养：</h2>
                            	<a onclick="OnClickTag(this)">卸妆</a>
                                <a onclick="OnClickTag(this)">防晒</a>
                                <a onclick="OnClickTag(this)">面膜</a>
                                <a onclick="OnClickTag(this)">面霜</a>
                                <a onclick="OnClickTag(this)">护手霜</a>
                                <a onclick="OnClickTag(this)">洁面</a>
                                <a onclick="OnClickTag(this)">保湿</a>
                                <a onclick="OnClickTag(this)">乳液</a>
                                <a onclick="OnClickTag(this)">眼霜</a>
                                <a onclick="OnClickTag(this)">爽肤水</a>
                                <a onclick="OnClickTag(this)">沐浴乳</a>
            				</div>
                        </div>
                    </li>
                    <!----配饰---->
                    <li class="postItem" style="display:none">
                    	<div class="gsT_r rgary">
                    		<div class="gs_key"><h2 class="f14">流行饰品：</h2>
                            	<a onclick="OnClickTag(this)">项链</a>
                            	<a onclick="OnClickTag(this)">耳环</a>
                                <a onclick="OnClickTag(this)">手链</a>
                                <a onclick="OnClickTag(this)">戒指</a>
                                <a onclick="OnClickTag(this)">脚链</a>
                                <a onclick="OnClickTag(this)">手表</a>
                                <a onclick="OnClickTag(this)">帽子</a>
                                <a onclick="OnClickTag(this)">挂件</a>
                                <a onclick="OnClickTag(this)">袜子</a>
                                <a onclick="OnClickTag(this)">太阳镜</a>
                                <a onclick="OnClickTag(this)">贴纸</a>
                                <a onclick="OnClickTag(this)">围巾</a>
                                <a onclick="OnClickTag(this)">胸针</a>
                                <a onclick="OnClickTag(this)">腰带</a>
                                <a onclick="OnClickTag(this)">发卡</a>
                			</div>
                        	<div class="gs_key"><h2 class="f14">元素：</h2>
                            	<a onclick="OnClickTag(this)">羽毛</a>
                                <a onclick="OnClickTag(this)">水晶</a>
                                <a onclick="OnClickTag(this)">珍珠</a>
                                <a onclick="OnClickTag(this)">四叶草</a>
                                <a onclick="OnClickTag(this)">水钻</a>
                                <a onclick="OnClickTag(this)">糖果</a>
                                <a onclick="OnClickTag(this)">复古</a>
                			</div>
                        </div>
                    </li>
                    <!----家居---->
                    <li class="postItem" style="display:none">
                    	<div class="gsT_r rgary">
                    		<div class="gs_key"><h2 class="f14">生活杂货：</h2>
                            	<a onclick="OnClickTag(this)">收纳</a>
                                <a onclick="OnClickTag(this)">首饰盒</a>
                                <a onclick="OnClickTag(this)">抱枕</a>
                                <a onclick="OnClickTag(this)">灯</a>
                                <a onclick="OnClickTag(this)">杯子</a>
                                <a onclick="OnClickTag(this)">玩偶</a>
                                <a onclick="OnClickTag(this)">文具</a>
                                <a onclick="OnClickTag(this)">iphone</a>
                                <a onclick="OnClickTag(this)">床上用品</a>
                                <a onclick="OnClickTag(this)">餐具</a>
                                <a onclick="OnClickTag(this)">摆件</a>
                                <a onclick="OnClickTag(this)">伞</a>
                                <a onclick="OnClickTag(this)">创意礼品</a>
                			</div>
                        	<div class="gs_key"><h2 class="f14">元素品牌：</h2>
                            	<a onclick="OnClickTag(this)">宜家</a>
                                <a onclick="OnClickTag(this)">地中海</a>
                                <a onclick="OnClickTag(this)">陶瓷</a>
                                <a onclick="OnClickTag(this)">卡通</a>
                                <a onclick="OnClickTag(this)">创意</a>
                			</div>
                        </div>
                    </li>
                </ul>
          	</div></td>
    </tr>
    <tr>
    	<td  height="30" align="center"s>标签：</td>
        <td width="622" ><input type="text" size="70" name="tag" id="tag" height="20" value="<?PHP echo $tag; ?>"  />&nbsp;</td>
    </tr>
    <tr>
    	<td  height="30"  align="center"s>金额：</td>
        <td ><input type="text" size="70" name="fee_view" id="fee_view" height="20" value="<?PHP echo $fee; ?>" disabled="disabled"/>&nbsp;
	        <input type="hidden" size="70" name="fee" id="fee" height="20" value="<?PHP echo $fee; ?>"/>
        </td>
    </tr>
    <tr>
    	<td  height="30" align="center"s>销售奖励：</td>
        <td ><input type="text" size="70" name="commission_view" id="commission_view" height="20" value="<?PHP echo round(0.1*$commission,2); ?>" disabled="disabled"/>&nbsp;
        <input type="hidden" size="70" name="commission" id="commission" height="20" value="<?PHP echo $commission; ?>"  /></td>
    </tr>
    <tr>
    	<td  height="30" align="center"s>图片：</td>
        <td ><input type="text" size="70" name="picurl" id="picurl" height="20" value="<?PHP echo $picurl; ?>"  /></td>
    </tr>
    <tr>
    	<td  height="30" align="right"s>推荐语：</td>
        <td ><textarea name="desc" id="desc" cols="56" rows="7"><?PHP echo $desc; ?></textarea>
          <br />
        <?PHP echo ShowBiaoQing("OnBiaoQing", 20); ?>        
        </td>
    </tr>
    <tr>
    	<td colspan="6" height="30" align="center"><input type="submit" name="submit" value="保存" style=" width:80px; height:23px" /></td>
    </tr>
</table>
</form>

<p align="center"><img id="pic" <?PHP if ($picurl!="") echo "src='".$picurl."'"; ?>/></p>
</body>
</html>

<script language="javascript">
<!--
$(document).ready(function(){
$("#systag").change(function() {
        $(".postItem").hide();
        var selectedIndex = $("#systag").get(0).selectedIndex;
        if(selectedIndex == 0)
            $(".postItemRe").show();
        else
        {
			$(".postItemRe").hide();
            $($(".postItem").get(selectedIndex - 1)).show();
        }
    });
});
-->
function OnClickTag(obj)
{
	document.getElementById("tag").value = document.getElementById("tag").value + " " + obj.innerHTML;
}
function OnSubmit()
{
	if (document.getElementById("itemid").value=="" ||
		document.getElementById("systag").value=="" ||
		document.getElementById("tag").value=="" ||
		document.getElementById("url").value=="" ||
		document.getElementById("itemname").value=="" ||
		document.getElementById("picurl").value=="" ||
		document.getElementById("fee").value=="" ||
		document.getElementById("commission").value=="")
	{
		alert("输入内容不能为空！");
		return false;
	}

	return true;
//	document.getElementById("frm").submit();
}

function OnBiaoQing(str)
{
	var obj = document.getElementById("desc");
    var ubbLength=obj.value.length; 
    obj.focus(); 
    if(typeof document.selection !="undefined") 
		document.selection.createRange().text=str; 
    else 
		obj.value=obj.value.substr(0,obj.selectionStart)+str+obj.value.substring(obj.selectionStart,ubbLength); 
}
</script>